package com.boot.security.server.dao.mffl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.mffl.MfflInformationCollect;
import org.springframework.security.core.parameters.P;

@Mapper
public interface MfflInformationCollectDao {

    @Select("select * from mffl_information_collect t where t.id = #{id}")
    MfflInformationCollect getById(Long id);

    @Delete("delete from mffl_information_collect where id = #{id}")
    int delete(Long id);

    int update(MfflInformationCollect mfflInformationCollect);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into mffl_information_collect(user_id, information_id) values(#{userId}, #{informationId})")
    int save(MfflInformationCollect mfflInformationCollect);

    int count(@Param("params") Map<String, Object> params);

    List<MfflInformationCollect> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);

    //我的收藏-查询是否收藏
    @Select("select * from mffl_information_collect t where t.user_id = #{userId} and t.information_id = #{informationId}")
    MfflInformationCollect getCountByReplyId(@Param("userId") Long id, @Param("informationId") long informationId);
}
